﻿using Domain.Context;
using Domain.Models;
using Microsoft.AspNetCore.Identity;

namespace Web.Extensions
{
    public static partial class ServiceExtensions 
    {
        public static IServiceCollection AspNetIdentitySetup(this IServiceCollection services)
        {
            services.AddIdentity<Account, Role>(options =>
                {
                    options.User.RequireUniqueEmail = true;
                    options.SignIn.RequireConfirmedEmail = false;
                    options.SignIn.RequireConfirmedPhoneNumber = false;
                    options.User.AllowedUserNameCharacters = "abcdefghijklmnopqrstuvwxyz_1234567890";
                })
                .AddSignInManager()
                .AddEntityFrameworkStores<ApplicationDBContext>()
                .AddDefaultTokenProviders();
            return services;
        }

    }
}
